package com.lichongbing.lyoggl.mapper;

import com.alibaba.fastjson.JSONObject;
import com.lichongbing.lyoggl.model.Project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Entity com.lichongbing.lyoggl.model.Project
 */
@Component
public interface ProjectMapper extends BaseMapper<Project> {
   @Select("select * from project where uid = #{uid}")
   List<Project> findByUid(String uid);
   @Delete("delete from project where id = #{id} and uid = #{uid}")
    int deleteByUid(String id,String uid);
   @Update("update project set name = #{name}, content = #{content} where  id = #{pid} ")
    void updateByUid(String name,String content, String pid);

    /**
     * 统计行数
     * @param uid
     * @return
     */
    int findRowsByUid(String uid);
    @Select("select name from project where id = #{pid}")
    String getProjectNamebypid(String pid);
}
